import sympy
from sympy import *
from sympy.abc import x,y,z,f
import numpy as np
l = np.array([2-1,2+np.sqrt(3)-2])
e = l/np.sqrt(l.dot(l))
print("e=",l)
f = x**2 + y**2
fx = diff(f,x)
fy = diff(f,y)
fxp = fx.evalf(subs = {x:1,y:2})
fyp = fy.evalf(subs = {x:1,y:2})
gradp = np.array([fxp,fyp])
print("dl =",gradp.dot(e))
print("gradp =",gradp)